import { createRouter, createWebHashHistory } from 'vue-router'
import LoginView from '../views/Login.vue'
// 可以使用动态的方法配置路由
const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: LoginView
    },
    {
      path: '/peerStream',
      name: 'peerStream',
      component: () => import('../views/PeerStream.vue')
    },
    {
      path: '/test',
      name: 'test',
      component: () => import('../views/Test.vue')
    },
    {
      path: '/:catchAll(.*)',
      name: 'error',
      component: () => import('../views/Error.vue')
    }
  ]
})


// 监听路由的变化
router.beforeEach((to, from, next) => {
  next()
})
router.afterEach(() => {
})
export default router
